katNumber :: Integer -> Integer
katNumber n 
	| n <= 0 	= error "Argument ungueltig"
	| otherwise 	= toInteger . round $ n' * r
	where
		n' = 1 / fromInteger (n + 1)
		p = fromInteger $ fact (2 * n)
		q = fromInteger $ fact n * fact n

		r = p / q

fact :: Integer -> Integer
fact 0 = 1
fact x = x * fact (x-1)


sumPowers :: Integer -> Integer -> Integer
sumPowers 0 _ = 0
sumPowers n k
	| k < 0 	= (-1)
	| otherwise 	= n^k + sumPowers (n-1) k



shrink :: Char -> String -> String
shrink _ [] = []
shrink _ [a] = [a]
shrink x (y:y1:ys)
	| x == y && x == y1	= shrink x (y1:ys)
	| otherwise 		= y : shrink x (y1:ys)


stretch :: Char -> Integer -> String -> String
stretch _ _ [] = []
stretch x n (y:ys)
	| n <= 0 && x == y = stretch x n ys
	| n > 0 && x == y  = (replicate (fromInteger n) x) ++ stretch x n ys
	| otherwise = y : stretch x n ys
